package tests;
import gropack.*;

import static org.junit.Assert.*;

import org.junit.Test;

public class TestPrinter {

	@Test
	public void testPlusPrinter() {
		ExprPrinter p = new ExprPrinter();
		(new PlusExpr(new IntExpr(1), new IntExpr(2))).accept(p);
		assertTrue("Printing", p.result().equals("(1+2)"));
	}
	
	@Test
	public void testMoinsPrinter() {
		ExprPrinter p = new ExprPrinter();
		(new MoinsExpr(new IntExpr(1), new IntExpr(2))).accept(p);
		assertTrue("Printing", p.result().equals("(1-2)"));
	}
	
	@Test
	public void testDivPrinter() {
		ExprPrinter p = new ExprPrinter();
		(new DivExpr(new IntExpr(1), new IntExpr(2))).accept(p);
		assertTrue("Printing", p.result().equals("(1/2)"));
	}
	
	@Test
	public void testMultPrinter() {
		ExprPrinter p = new ExprPrinter();
		(new MultExpr(new IntExpr(1), new IntExpr(2))).accept(p);
		assertTrue("Printing", p.result().equals("(1*2)"));
	}

	@Test
	public void testOp1Printer() {
		ExprPrinter p = new ExprPrinter();
		(new MoinsExpr(new IntExpr(5),(new PlusExpr(new IntExpr(1), new IntExpr(2))))).accept(p);
		assertTrue("Printing", p.result().equals("(5-(1+2))"));
	}
}
